package acwing._2LanQiao._7Greedy;
/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._2LanQiao._7Greedy
 * @File : Q0112.java
 * @Author : WangRuoyu
 * @Date : 2023/3/20 10:46
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Q0112 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");

        int n = Integer.parseInt(words[0]);
        int d = Integer.parseInt(words[1]);

        double[][] interval = new double[n][2];

        for (int i = 0; i < n; ++i) {
            words = br.readLine().split(" ");
            int x = Integer.parseInt(words[0]);
            int y = Integer.parseInt(words[1]);
            double r = Math.sqrt(d * d - y * y);
            if (y > d) {
                System.out.println(-1);
                return;
            }
            interval[i][0] = x - r;
            interval[i][1] = x + r;
        }

        Arrays.sort(interval, (o1, o2) -> {
            if (o1[1] == o2[1]) {
                if (o1[0] - o2[0] > 0) {
                    return 1;
                } else if (o1[0] - o2[0] < 0) {
                    return -1;
                } else {
                    return 0;
                }
            } else {
                if (o1[1] - o2[1] > 0) {
                    return 1;
                } else if (o1[1] - o2[1] < 0) {
                    return -1;
                } else {
                    return 0;
                }
            }
        });

        int cnt = 0;
        double index = -10000;
        for (int i = 0; i < n; ++i) {
            if (index < interval[i][0]) {
                cnt++;
                index = interval[i][1];
            }
        }

        System.out.println(cnt);
    }
}

